package com.xwli.springcloud.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author xwli
 * @date: 2022/8/25 16:00
 * @desc 注入拦截器
 * @since JDK 1.8
 */
@Configuration
public class WebConfiguration implements WebMvcConfigurer {

    @Autowired
    private AutoCheckTokenInterceptor autoIdempotentInterceptor;

    /**
     * 添加拦截器
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(autoIdempotentInterceptor);
    }

}
